<html>
<body>
Reports access to a non-<code>final</code> field inside a <code>compareTo()</code> implementation.
<p>
  Such access may result in <code>compareTo()</code>
  returning different results at different points in the object's lifecycle, which may in turn cause problems when
  using the standard collections classes, for example <code>java.util.TreeSet</code>.
</p>
<p>
  A quick-fix to make the field <code>final</code> is available
  only when there is no write access to the field, otherwise no fixes are suggested.
</p>
<p><b>Example:</b></p>
<pre><code>
  class Foo implements Comparable&lt;Foo&gt;{
    private int index;
    Foo(int idx) {
      index = idx;
    }
    @Override
    public int compareTo(Foo foo) {
     return Integer.compare(this.index, foo.index);
    }
  }
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
  class Foo implements Comparable&lt;Foo&gt;{
    private final int index;
    Foo(int idx) {
      index = idx;
    }
    @Override
    public int compareTo(Foo foo) {
      return Integer.compare(this.index, foo.index);
    }
  }
</code></pre>
<!-- tooltip end -->

</body>
</html>